#ifndef __PLAYER_H__
#define __PLAYER_H__

#include "cocos2d.h"
#include "SocketClient.h"
#include "PlayerSprite.h"
#include <mutex>
USING_NS_CC;

#define sPlayer				Player::GetInstance()
#define sPlayerSprite		sPlayer->GetSprite()
#define sSocket				sPlayer->GetSocket()
#define ThreadLocker		std::lock_guard<std::mutex>

struct PlayerMsgQueue
{
	std::vector<std::string> MsgQueue;
};

class Player
{
public:
	Player();
	~Player();

	static Player* GetInstance();
	SocketClient* GetSocket()	{ return _PlayerSocket; }
	PlayerSprite* GetSprite()	{ return _PlayerSprite; }
private:
	SocketClient* _PlayerSocket;
	PlayerSprite* _PlayerSprite;
	PlayerMsgQueue _PlayerMsgQueue;

	std::mutex PlayerMessageLock;


//NetWork
private:
	void PlayerSendMsgThread();
	void PlayerAddMsgThread(std::string msg);
	//std::thread SendMsgThread;
public:
	void AddMsgToList(std::string _msg);
};








#endif